export class StoreFilter {
    constructor({ enabled = true, excludeDefaultStore = false, employeeId = null } = {}) {
        this.enabled = enabled;
        this.excludeDefaultStore = excludeDefaultStore;
        this.employeeId = employeeId;
    }

    clear() {
        this.enabled = null;
        // 不清除 employeeId
    }

    static clone(filter) {
        return new StoreFilter({
            enabled: filter.enabled,
            excludeDefaultStore: filter.excludeDefaultStore,
            employeeId: filter.employeeId
        });
    }

    toJson() {
        const ret = {};
        if (this.enabled != null) {
            ret.enabled = this.enabled ? 1 : 0;
        }
        if (this.excludeDefaultStore) {
            ret.a_neq_defaultStore = 1;
        }
        if (this.employeeId) {
            ret.ign_employeeId = this.employeeId;
        }
        return ret;
    }
}
